com.highdeal.pnr.hci
Class ChargingPlanDictionaryModel

java.lang.Object
  extended by com.highdeal.pnr.hci.ChargingPlanDictionaryModel
All Implemented Interfaces:
XMLMarshallable

public class ChargingPlanDictionaryModel
extends java.lang.Object
implements XMLMarshallable

This class represents the dictionary for all the charging plans of the charge component.

Since:
Transactive 4.0

XML API for HCI

The XML APIs specify the following XSD fragment:

XSD Fragment

<xs:element name="chargingPlanDictionary">
  <xs:complexType>
   <xs:sequence>
    <xs:choice>
     <xs:element ref="dictionaryComponent" minOccurs="0" maxOccurs="unbounded"/>
     <xs:element ref="typedDictionaryComponent" minOccurs="0" maxOccurs="unbounded"/>
    </xs:choice>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
<xs:element name="dictionaryComponent">
   <xs:complexType>
     <xs:attribute name="internalChargingReference" type="xs:string" use="required"/>
     <xs:attribute name="backupChargingReference" type="xs:string" default="_default_charging_reference_"/>
   </xs:complexType>
 </xs:element>
<xs:element name="typedDictionaryComponent">
   <xs:complexType>
     <xs:attribute name="internalChargingReference" type="xs:string" use="required"/>
     <xs:attribute name="chargingReferenceType" type="AccountType" use="required"/>
   </xs:complexType>
 </xs:element>


Field Summary
static java.lang.String DEFAULT_CHARGING_REFERENCE
          This string represents the default charging reference in the dictionary.
 
Constructor Summary
ChargingPlanDictionaryModel()
          Create an empty dictionary.
ChargingPlanDictionaryModel(java.util.LinkedHashMap<java.lang.String,java.lang.Object> dictionary, boolean dictionaryTyped)
           
 
Method Summary
 void addAllReferencesFrom(ChargingPlanDictionaryModel other)
          Adds all charging references of the given dictionary in the current dictionary.
 void addBackupChargingReference(java.lang.String internal, java.lang.String backup)
          Adds a backup charging reference to the internal charging reference.
 void addCharacterData(java.lang.String cData)
          Adds character data to the content element.
 void addChargingReferenceType(java.lang.String internal, ChargingPlanAccountType type)
          Adds a charging reference type to the internal charging reference.
 void addChild(java.lang.String tagName, XMLMarshallable child)
          Adds a child to the object, the child representing the marshallable object which must be added to the element.
 java.lang.Object clone()
           
 java.lang.String getBackupChargingReference(java.lang.String internal)
          Return the backup charging reference corresponding to the internal charging reference.
 ChargingPlanAccountType getChargingReferenceType(java.lang.String internal)
          Return the account type of the charging reference corresponding to the internal charging reference.
 java.util.HashMap<java.lang.String,java.lang.Object> getDictionary()
          Returns the HashMap representing the dictionary
 java.util.Iterator<java.lang.String> getInternalChargingReferences()
          Gets a iteration of all internal charging references of the dictionary.
 java.lang.String hasCycle()
          Cycle detection in the dictionary.
 java.lang.String hasCycleFrom(java.lang.String internal)
          Cycle detection in the dictionary starting from a internal charging reference.
 boolean isDictionaryTyped()
          Returns true if the charging references in the dictionary are typed.
 void marshal(XMLOutputter output)
          Gives an XML representation of this object, including its children.
 void removeInternalChargingReference(java.lang.String internal)
          Removes the internal charging reference and shifts all the corresponding backup references to default charging reference.
 void replaceChargingReferenceType(java.lang.String internal, ChargingPlanAccountType oldType, ChargingPlanAccountType newType)
          Replace a account type of the charging reference by another one.
 void replaceInternalChargingReference(java.lang.String oldInternal, java.lang.String newInternal)
          Replace an internal charging reference by another one.
 void setAttributes(XMLAttributes atts)
          Sets the attributes of the XML representation of the element being processed.
 void setDictionaryTyped(boolean dictionaryTyped)
           
 int size()
          Returns the number charging references in the dictionary.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CHARGING_REFERENCE

public static final java.lang.String DEFAULT_CHARGING_REFERENCE
This string represents the default charging reference in the dictionary.

See Also:
Constant Field Values
Constructor Detail

ChargingPlanDictionaryModel

public ChargingPlanDictionaryModel()
Create an empty dictionary.


ChargingPlanDictionaryModel

public ChargingPlanDictionaryModel(java.util.LinkedHashMap<java.lang.String,java.lang.Object> dictionary,
                                   boolean dictionaryTyped)
Method Detail

getInternalChargingReferences

public java.util.Iterator<java.lang.String> getInternalChargingReferences()
Gets a iteration of all internal charging references of the dictionary.

Returns:
A iteration of all internal charging references of the dictionary.

replaceInternalChargingReference

public void replaceInternalChargingReference(java.lang.String oldInternal,
                                             java.lang.String newInternal)
Replace an internal charging reference by another one. If the reference is referenced as backup in the dictionary, this backup is replaced too.

Parameters:
oldInternal - the reference to replace.
newInternal - the new reference.
Throws:
java.lang.NullPointerException - is thrown in the twice following cases:
  • the parameter "oldInternal" is null
  • the parameter "newInternal" is null

removeInternalChargingReference

public void removeInternalChargingReference(java.lang.String internal)
Removes the internal charging reference and shifts all the corresponding backup references to default charging reference.

Parameters:
internal - the internal charging reference.
Throws:
java.lang.NullPointerException - is thrown when the parameter "internal" is null.

getChargingReferenceType

public ChargingPlanAccountType getChargingReferenceType(java.lang.String internal)
Return the account type of the charging reference corresponding to the internal charging reference.

Parameters:
internal - the internal charging reference for which, we want the corresponding account type.
Returns:
the account type of the charging reference corresponding to the internal charging reference. It can be null if the internal charging reference doesn't exist in the dictionary or doesn't define an account type.

addChargingReferenceType

public void addChargingReferenceType(java.lang.String internal,
                                     ChargingPlanAccountType type)
Adds a charging reference type to the internal charging reference.

Parameters:
internal - the internal charging reference.
type - the internal charging reference type.
Throws:
java.lang.NullPointerException - is thrown in the twice following cases:
  • the parameter "internal" is null
  • the parameter "type" is null

replaceChargingReferenceType

public void replaceChargingReferenceType(java.lang.String internal,
                                         ChargingPlanAccountType oldType,
                                         ChargingPlanAccountType newType)
Replace a account type of the charging reference by another one.

Parameters:
oldType - the reference type to replace.
newType - the new reference type.
Throws:
java.lang.NullPointerException - is thrown in the twice following cases:
  • the parameter "oldType" is null
  • the parameter "newType" is null

getBackupChargingReference

public java.lang.String getBackupChargingReference(java.lang.String internal)
Return the backup charging reference corresponding to the internal charging reference.

Parameters:
internal - the internal charging reference for which, we want the corresponding backup.
Returns:
the backup charging reference corresponding to the internal charging reference. It can be null if the internal charging reference doesn't exist in the dictionary.

addBackupChargingReference

public void addBackupChargingReference(java.lang.String internal,
                                       java.lang.String backup)
Adds a backup charging reference to the internal charging reference.

The backup charging reference has to be already present in the dictionary and the internal charging reference has to be a new one in the dictionary.

Parameters:
internal - the internal charging reference.
backup - the backup charging reference corresponding to the internal charging reference.
Throws:
java.lang.NullPointerException - is thrown in the twice following cases:
  • the parameter "internal" is null
  • the parameters "backup" is null
java.lang.IllegalArgumentException - is thrown in the twice following cases:
  • the internal charging reference already exists in the dictionary (then already has a backup)
  • the internal charging reference is the default one
  • the backup charging reference doesn't exist in the dictionary (except the default one)

addAllReferencesFrom

public void addAllReferencesFrom(ChargingPlanDictionaryModel other)
Adds all charging references of the given dictionary in the current dictionary.

Parameters:
other - The dictionary from which we get the charging references.

size

public int size()
Returns the number charging references in the dictionary.

Returns:
The number charging references in the dictionary.

getDictionary

public java.util.HashMap<java.lang.String,java.lang.Object> getDictionary()
Returns the HashMap representing the dictionary

Returns:
The HashMap representing the dictionary

setDictionaryTyped

public void setDictionaryTyped(boolean dictionaryTyped)

isDictionaryTyped

public boolean isDictionaryTyped()
Returns true if the charging references in the dictionary are typed.

Returns:
true if the charging references in the dictionary are typed.

hasCycleFrom

public java.lang.String hasCycleFrom(java.lang.String internal)
Cycle detection in the dictionary starting from a internal charging reference.

Parameters:
internal - the internal charging reference of the start.
Returns:
the internal charging reference from which the cycle begin or null otherwise.

hasCycle

public java.lang.String hasCycle()
Cycle detection in the dictionary.

Returns:
the internal charging reference from which the cycle begin or null otherwise.

setAttributes

public void setAttributes(XMLAttributes atts)
Description copied from interface: XMLMarshallable
Sets the attributes of the XML representation of the element being processed.

Specified by:
setAttributes in interface XMLMarshallable
Parameters:
atts - The XML attributes of the current element

addChild

public void addChild(java.lang.String tagName,
                     XMLMarshallable child)
Description copied from interface: XMLMarshallable
Adds a child to the object, the child representing the marshallable object which must be added to the element.

Specified by:
addChild in interface XMLMarshallable
Parameters:
tagName - The name of tag for the child
child - The child to be added

addCharacterData

public void addCharacterData(java.lang.String cData)
Description copied from interface: XMLMarshallable
Adds character data to the content element.

Specified by:
addCharacterData in interface XMLMarshallable
Parameters:
cData - The character data to be added

marshal

public void marshal(XMLOutputter output)
Description copied from interface: XMLMarshallable
Gives an XML representation of this object, including its children.

Specified by:
marshal in interface XMLMarshallable
Parameters:
output - The XML output to marshal the object into

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)